package com.zhanjixun.weixin.frame;

import javax.swing.*;

/**
 * 二维码窗体
 *
 * @author :zhanjixun
 * @date : 2018/10/19 23:59
 */
public class ImageFrame extends JFrame {

    private final JLabel label;

    public ImageFrame() {
        this("break.png");
    }

    public ImageFrame(String image) {
        setTitle("请扫描二维码");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(435, 450);
        setLocationRelativeTo(getOwner());
        setResizable(false);
        label = new JLabel();
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setIcon(new ImageIcon(image));
        add(label);
    }

    public void setImage(String imagePath) {
        label.setIcon(new ImageIcon(imagePath));
    }

}



